#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
//	system("start https://www.lanqiao.cn/problems/4177/learning/");

	int t, n;
	cin >> t;

	while (t--) {
		cin >> n;

		if (n < 3)
			cout << 0 << endl;
		else if (n > 3)
			cout << (n / 2 - 1) * 3 + (n % 2 * 2) << endl;
		else cout << 2 << endl;
	}
	return 0;
}
